package com.hlhj.funlike_business.moudle;

import android.content.Context;

import com.example.mymvp.mvp.BaseModule;
import com.hlhj.funlike_business.api.Apis;
import com.hlhj.funlike_business.api.BaseObser;
import com.hlhj.funlike_business.bean.FoodTypeBean;
import com.lzy.okgo.model.Response;

import java.util.List;

public class MineFoodFgmMoudle implements BaseModule{
    public interface getFoodList{
        void showFoodList(List<FoodTypeBean.DataBean> dataBeans);
    }

    public getFoodList listener;

    public void setListener(getFoodList listener) {
        this.listener = listener;
    }

    public void LoadFoodList(Context context){
        Apis.INSTANCE.GetGoodTypeList()
                .subscribe(new BaseObser<Response<FoodTypeBean>>(context) {
                    @Override
                    public void httpSuccess(Response<FoodTypeBean> foodTypeBeanResponse) {
                        if (listener!=null){
                            listener.showFoodList(foodTypeBeanResponse.body().getData());
                        }
                    }
                });
    }
}
